/*
 * Created by: vadikv
 * Created: Thursday, March 06, 2008
 */

using System.Collections.Generic;

namespace OneDayModel.Interfaces
{
    public interface IRepository
    {
        IList<IRole> GetRoles();
        IUser NewUser();
        bool IsAliasUnique(string alias);
        IUser GetUserByEmail(string email);
        void CreateUser(string alias, string email, string password, IEnumerable<IRole> assignedRoles, IEnumerable<KeyValuePair<string, string>> attributes, AccountStatus userAccountStatus);
        void RegisterConfirmationSent(string alias, string confirmationId);
        IUser GetUserPendingForConfirmation(string confirmationId);
        void UpdateUser(string alias, List<KeyValuePair<string, string>> changes);
        void RegisterConfirmationDone(string confirmationId);
        IUser GetUserByAlias(string alias);
        StatisticsStruct CollectStatistics();
        IAlbum RegisterAlbum(IUser user, string albumName);
        IAlbum GetAlbumForUser(string alias, string albumName);
        string GetBasePathForAlbums(string userAlias);
        void RegisterPictureInAlbum(string userAlias, string albumName, string fileName);
    }

    public class StatisticsStruct
    {
        private readonly IEnumerable<Statistic> totals;
        private readonly IEnumerable<Statistic> online;
        private readonly IEnumerable<Statistic> newToday;

        public StatisticsStruct(IEnumerable<Statistic> totals, IEnumerable<Statistic> online, IEnumerable<Statistic> newToday)
        {
            this.totals = totals;
            this.newToday = newToday;
            this.online = online;
        }

        public IEnumerable<Statistic> Totals
        {
            get { return totals; }
        }

        public IEnumerable<Statistic> Online
        {
            get { return online; }
        }

        public IEnumerable<Statistic> NewToday
        {
            get { return newToday; }
        }
    }

    public class Statistic
    {
        private string role;
        private int value;

        public Statistic(string role, int value)
        {
            this.role = role;
            this.value = value;
        }

        public string Role
        {
            get { return role; }
        }

        public int Value
        {
            get { return value; }
        }
    }
}